<?php

$dbHost = "127.0.0.1:3306";

$dbUser = "root";

$dbPass = "babilonia";

$dbData = "protocolo";

$conn = mysql_connect($dbHost,$dbUser,$dbPass) or die(mysql_error());

mysql_select_db($dbData,$conn) or die(mysql_error());

//mysql_set_charset('latim1');
mysql_set_charset('utf-8');

if (!isset($_SESSION)) {
  session_start();
}

if (isset($_SESSION["Setor"])) {
	$setor_logado = $_SESSION["Setor"];
}

echo $setor_logado;
if($conn) {
	echo 'Conectou';
	
	$sql_select = mysql_query("SELECT * FROM tab_protocolo WHERE Origem='$setor_logado'");
	
	$qnt = mysql_num_rows($sql_select);
	
	if($qnt > 0) {
		$i = 1;
		while($obj= mysql_fetch_assoc($sql_select)) {
			$arr[] = $obj;
			echo $i;
			$i++;
		}
	} else {
		echo "Falha";
	}
}

?>